/**
 * FileName: OrderFrameDecoder
 * Author:   powersi
 * Date:     2021/2/28 17:20
 * Description:
 */
package com.zm.demo.netty.action.server.codec;

import com.zm.demo.netty.action.common.RequestMessage;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * Description: 
 * Author:      powersi
 * Date:        2021/2/28 17:20
 */
public class OrderProtocolDecoder extends MessageToMessageDecoder<ByteBuf> {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
        RequestMessage requestMessage = new RequestMessage();
        requestMessage.decode(msg);
        out.add(requestMessage);
    }
}
